import PageTools from './PageTools'
import UploadExcel from './UploadExcel'
import UploadImg from './UploadImg'
import Lang from '@/components/Lang'
import ScreenFull from '@/components/ScreenFull'
import store from '@/store'
export default {
  install(Vue) {
    Vue.component('PageTools', PageTools)
    Vue.component('UploadExcel', UploadExcel)
    Vue.component('UploadImg', UploadImg)
    Vue.component('Lang', Lang)
    Vue.component('ScreenFull', ScreenFull)

    // 注册一个全局自定义指令 `v-allow`
    Vue.directive('allow', {
      inserted: function(el, binding) {
        // 从vuex中取出points,
        const points = store.state.user.userInfo.roles.points
        // 如果points有binding.value则显示
        if (points.includes(binding.value)) {
          // console.log('判断这个元素是否会显示', el, binding.value)
        } else {
          el.parentNode.removeChild(el)
          // el.style.display = 'none'
        }
      }
    })
  }
}

